// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_img.p_video;

import android.content.res.Resources;
import android.graphics.*;
import android.graphics.drawable.Drawable;
import android.view.View;
import com.nnee.p_g.cls_b;

// Referenced classes of package com.nnee.p_img.p_video:
//            m

class cls_ao
{

    public cls_ao(View view)
    {
        n = cls_m.aNone;
        p = false;
        a = view;
    }

    private void d()
    {
        Resources resources = a.getResources();
        r = resources.getDrawable(0x7f02003f);
        s = resources.getDrawable(0x7f02003e);
    }

    private Rect e()
    {
        RectF rectf = new RectF(k.left, k.top, k.right, k.bottom);
        l.mapRect(rectf);
        return new Rect(Math.round(rectf.left), Math.round(rectf.top), Math.round(rectf.right), Math.round(rectf.bottom));
    }

    public int a(float f1, float f2)
    {
        boolean flag = false;
        Rect rect = e();
        boolean flag1;
        int i1;
        int j1;
        if(f2 >= (float)rect.top - 20F && f2 < 20F + (float)rect.bottom)
            flag1 = true;
        else
            flag1 = flag;
        if(f1 >= (float)rect.left - 20F && f1 < 20F + (float)rect.right)
            flag = true;
        if(Math.abs((float)rect.left - f1) < 20F && flag1)
            i1 = 3;
        else
            i1 = 1;
        if(Math.abs((float)rect.right - f1) < 20F && flag1)
            i1 |= 4;
        if(Math.abs((float)rect.top - f2) < 20F && flag)
            i1 |= 8;
        if(Math.abs((float)rect.bottom - f2) < 20F && flag)
            j1 = i1 | 0x10;
        else
            j1 = i1;
        if(j1 == 1 && rect.contains((int)f1, (int)f2))
            j1 = 32;
        return j1;
    }

    void a(int i1, float f1, float f2)
    {
        Rect rect = e();
        if(i1 != 1)
            if(i1 == 32)
            {
                b(f1 * (k.width() / (float)rect.width()), f2 * (k.height() / (float)rect.height()));
            } else
            {
                if((i1 & 6) == 0)
                    f1 = 0F;
                if((i1 & 0x18) == 0)
                    f2 = 0F;
                float f3 = f1 * (k.width() / (float)rect.width());
                float f4 = f2 * (k.height() / (float)rect.height());
                int j1;
                float f5;
                int k1;
                if((i1 & 2) != 0)
                    j1 = -1;
                else
                    j1 = 1;
                f5 = f3 * (float)j1;
                if((i1 & 8) != 0)
                    k1 = -1;
                else
                    k1 = 1;
                c(f5, f4 * (float)k1);
            }
    }

    protected void a(Canvas canvas)
    {
        if(!i){
        	canvas.save();
            Path path = new Path();
            if(!a())
            {
                v.setColor(0xff000000);
                canvas.drawRect(j, v);
            } else
            {
                Rect rect = new Rect();
                a.getDrawingRect(rect);
                path.addRect(new RectF(j), android.graphics.Path.Direction.CW);
                v.setColor(-30208);
                canvas.clipPath(path, android.graphics.Region.Op.DIFFERENCE);
                Paint paint;
                if(a())
                    paint = t;
                else
                    paint = u;
                canvas.drawRect(rect, paint);
                canvas.restore();
                canvas.drawPath(path, v);
                if(n == cls_m.cGrow)
                {
                    int i1 = 1 + j.left;
                    int j1 = 1 + j.right;
                    int k1 = 4 + j.top;
                    int l1 = 3 + j.bottom;
                    int i2 = r.getIntrinsicWidth() / 2;
                    int j2 = r.getIntrinsicHeight() / 2;
                    int k2 = s.getIntrinsicHeight() / 2;
                    int l2 = s.getIntrinsicWidth() / 2;
                    int i3 = j.left + (j.right - j.left) / 2;
                    int j3 = j.top + (j.bottom - j.top) / 2;
                    r.setBounds(i1 - i2, j3 - j2, i1 + i2, j3 + j2);
                    r.draw(canvas);
                    r.setBounds(j1 - i2, j3 - j2, j1 + i2, j3 + j2);
                    r.draw(canvas);
                    s.setBounds(i3 - l2, k1 - k2, i3 + l2, k1 + k2);
                    s.draw(canvas);
                    s.setBounds(i3 - l2, l1 - k2, i3 + l2, l1 + k2);
                    s.draw(canvas);
                }
            }
        }
    }

    public void a(Matrix matrix, Rect rect, RectF rectf, boolean flag)
    {
        l = new Matrix(matrix);
        k = rectf;
        o = new RectF(rect);
        p = flag;
        q = k.width() / k.height();
        j = e();
        t.setARGB(125, 50, 50, 50);
        u.setARGB(125, 50, 50, 50);
        v.setStrokeWidth(3F);
        v.setStyle(android.graphics.Paint.Style.STROKE);
        v.setAntiAlias(true);
        n = cls_m.aNone;
        d();
    }

    public void a(cls_m m1)
    {
        if(m1 != n)
        {
            n = m1;
            a.invalidate();
        }
    }

    public void a(boolean flag)
    {
        h = flag;
    }

    public boolean a()
    {
        return h;
    }

    public Rect b()
    {
        return new Rect((int)k.left, (int)k.top, (int)k.right, (int)k.bottom);
    }

    void b(float f1, float f2)
    {
        Rect rect = new Rect(j);
        k.offset(f1, f2);
        k.offset(Math.max(0F, o.left - k.left), Math.max(0F, o.top - k.top));
        k.offset(Math.min(0F, o.right - k.right), Math.min(0F, o.bottom - k.bottom));
        j = e();
        rect.union(j);
        rect.inset(-10, -10);
        a.invalidate(rect);
    }

    public void b(boolean flag)
    {
        i = flag;
    }

    public void c()
    {
        j = e();
    }

    void c(float f1, float f2)
    {
        RectF rectf;
        float f3;
        float f4;
        if(p)
            if(f1 != 0F)
                f2 = f1 / q;
            else
            if(f2 != 0F)
                f1 = f2 * q;
        rectf = new RectF(k);
        if(f1 <= 0F || rectf.width() + 2F * f1 <= o.width()) {
        	f3 = f2;
            f4 = f1;
             
        } else
        {
        	f1 = (o.width() - rectf.width()) / 2F;
            if(!p) {
            	f3 = f2;
                f4 = f1;
            } else {
            	f3 = f1 / q;
                f4 = f1;
            }
        }
        
        if(f3 > 0F && rectf.height() + 2F * f3 > o.height())
        {
            f3 = (o.height() - rectf.height()) / 2F;
            if(p)
                f4 = f3 * q;
        }
        com.nnee.p_g.cls_b.c("HighlightView", (new StringBuilder()).append("dx is: ").append(f4).append("dy is: ").append(f3).toString());
        rectf.inset(-f4, -f3);
        if(rectf.width() > 152F && rectf.height() > 15F) {
        	if(rectf.width() < 25F)
                rectf.inset(-(25F - rectf.width()) / 2F, 0F);
            float f5;
            if(p)
                f5 = 25F / q;
            else
                f5 = 25F;
            if(rectf.height() < f5)
                rectf.inset(0F, -(f5 - rectf.height()) / 2F);
            if(rectf.left < o.left)
                rectf.offset(o.left - rectf.left, 0F);
            else
            if(rectf.right > o.right)
                rectf.offset(-(rectf.right - o.right), 0F);
            if(rectf.top >= o.top)
            	return;
            rectf.offset(0F, o.top - rectf.top);
            
            k.set(rectf);
            j = e();
            a.invalidate();
        } else {
        	return;
        }

    }

    public static final int b = 1;
    public static final int c = 2;
    public static final int d = 4;
    public static final int e = 8;
    public static final int f = 16;
    public static final int g = 32;
    private static final String m = "HighlightView";
    View a;
    boolean h;
    boolean i;
    Rect j;
    RectF k;
    Matrix l;
    private cls_m n;
    private RectF o;
    private boolean p;
    private float q;
    private Drawable r;
    private Drawable s;
    private final Paint t = new Paint();
    private final Paint u = new Paint();
    private final Paint v = new Paint();
}
